package cn.bdqn.test;

public class AddThread implements Runnable {
    private static int startNum=1;
    private static int total=0;
    @Override
    public void run() {
        int num = 0;
        int i = startNum;
        for (; i < startNum + 10; i++) {
            num += i;
        }
        startNum = i;
        System.out.println(Thread.currentThread().getName() + "和为：" + num);
        total += num;
    }
    public void add(){
        System.out.println("10个线程相加和为"+total);
    }


}
